<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:include page="common/simple_header.jsp">
    <jsp:param name="title" value="用户登录"/>
    <jsp:param name="customCss" value="login"/>
</jsp:include>

<div class="container">
    <h3>用户登录</h3>

    <div class="error-message" id="error-message">
        <c:if test="${not empty errMsg}">
            ${errMsg}
        </c:if>
    </div>

    <form id="loginForm" method="post" action="${pageContext.request.contextPath}/loginServlet">
        <div class="form-group">
            <label for="uname">用户名：</label>
            <input type="text" id="uname" name="uname" placeholder="请输入用户名" value="wang" autocomplete="username">
            <div class="error-text"></div>
        </div>

        <div class="form-group">
            <label for="pwd">密码：</label>
            <input type="password" id="pwd" name="pwd" placeholder="请输入密码" value="q123456"
                   autocomplete="current-password">
            <div class="error-text"></div>
        </div>

        <div class="form-group">
            <label for="vcode">验证码：</label>
            <div class="captcha-group">
                <input type="text" id="vcode" name="vcode" placeholder="请输入验证码" autocomplete="off">
                <img id="captcha" src="${pageContext.request.contextPath}/verifyCodeImgServlet"
                     alt="验证码" title="点击刷新验证码" onclick="refreshCaptcha()">
            </div>
            <div class="error-text"></div>
        </div>

        <div class="form-actions">
            <input type="submit" value="登录" class="btn btn-primary">
            <input type="reset" value="重置" class="btn btn-secondary">
        </div>
    </form>

    <div class="register-link">
        <p>还没有账号？<a href="${pageContext.request.contextPath}/toRegisterServlet">立即注册</a></p>
    </div>
</div>

<jsp:include page="common/footer.jsp">
    <jsp:param name="customJs" value="login"/>
</jsp:include>
